package org.reliablesource.prism.core.tests;

import junit.framework.TestCase;

import org.reliablesource.prism.core.IPrismAnnotation;
import org.reliablesource.prism.core.IPrismElementFactory;
import org.reliablesource.prism.core.IPrismNode;
import org.reliablesource.prism.core.IPrismScreen;
import org.reliablesource.prism.core.IPrismTutorial;
import org.reliablesource.prism.core.plugin.PrismCorePlugin;

/**
 *
 *  PrismElementFactoryTest.java
 *  Copyright (c) 2006, Reliable Source, Inc. All Rights Reserved
 *
 *	Created on: Sep 20, 2006 
 *  @author Dennis Park <a href="mailto:dennis.park@gmail.com">dennis.park@gmail.com</a>
 *
 */

public class PrismElementFactoryTest extends TestCase {

	protected IPrismElementFactory factory;
	
	/**
	 * @param arg0
	 */
	public PrismElementFactoryTest(String arg0) {
		super(arg0);
		factory = PrismCorePlugin.getDefault().getElementFactory();
		assertNotNull(factory);
	}

	/**
	 * Test method for {@link org.reliablesource.prism.core.internal.PrismElementFactory#createTutorialNode()}.
	 */
	public void testCreateTutorialNode() {
		IPrismNode node = factory.createTutorialNode();
		assertNotNull(node.getParent());
		assertNotNull(node.getId());
		assertNotNull(node.getName());
	}

	/**
	 * Test method for {@link org.reliablesource.prism.core.internal.PrismElementFactory#createScreen()}.
	 */
	public void testCreateScreen() {
		IPrismScreen screen = factory.createScreen();
		assertNotNull(screen.getParent());
		assertNotNull(screen.getId());
		assertNotNull(screen.getName());
	}

	/**
	 * Test method for {@link org.reliablesource.prism.core.internal.PrismElementFactory#createTestTutorialNode()}.
	 */
	public void testCreateTestTutorialNode() {
		IPrismTutorial tutorial = factory.createTutorialNode();
		assertNotNull("factory didn't create tutorial", tutorial);
		assertEquals("factory created more than one tutorial.",tutorial, factory.createTutorialNode());
	}

	/**
	 * Test method for {@link org.reliablesource.prism.core.internal.PrismElementFactory#createTestScreen()}.
	 */
	public void testCreateTestScreen() {
		IPrismScreen screen = factory.createScreen();
		assertNotNull("factory didn't create screen", screen);
		assertNotSame("factory didn't create more than one screen.",screen, factory.createScreen());
	}

	/**
	 * Test method for {@link org.reliablesource.prism.core.internal.PrismElementFactory#createPrismAnnotation(org.reliablesource.prism.core.IPrismScreen)}.
	 */
	public void testCreatePrismAnnotation() {
		IPrismScreen screen = factory.createScreen();
		IPrismAnnotation annotation = factory.createPrismAnnotation(screen);
		assertNotNull("factory didn't create an annotation",annotation);
		assertNotSame("factory didn't create more than one annotation.",annotation, factory.createPrismAnnotation(screen));
	}

}
